#define  _CRT_SECURE_NO_WARNINGS 1	
#include<stdio.h>
#define N 51
int main()
{
    int delet;
    int t;
    int i, j, n;
    int a[N];
    for (int i = 0; i < 51; i++)
        a[i] = 1000;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    scanf("%d", &delet);
    for (i = 0; i < n; i++)
    {
        if (a[i] == delet)
        {
            for (j = i; j <= n; j++)
                a[j] = a[j + 1];
            n--;
            i = -1;
        }
    }
    for (j = 0; j < n; j++)
        printf("%d ", a[j]);
}
